package de.htwg.memory;

import java.io.IOException;

import org.json.JSONArray;
import org.json.JSONException;

/**
 * Interface class of conenction for easy exchange of the connection class
 * 
 * @author Benjamin Moellerker <bemoelle@googlemail.com>
 * @version V1.0 17-06-2012
 */
public interface IConnection {

	/**
	 * @param row is the rows of the memory game
	 * @param col is the columns of the memory game
	 * @return jsonarray which have the ids for memory cards
	 * @throws JSONException from JSON
	 * @throws IOException from methode request()
	 */
	public abstract JSONArray readMemory(int row, int col)
			throws JSONException, IOException;

	/**
	 * send an request to the webserver to check whether cards are equal
	 * 
	 * @param firstCard id of the first card
	 * @param secondCard id of the second card
	 * @return 0: not equal, 1: equal, 2: equal and game finished
	 * @throws JSONException from JSON
	 * @throws IOException from methode request()
	 */
	public abstract int readCardState(int firstCard, int secondCard)
			throws JSONException, IOException;

}